//===============================================================================
// Microsoft patterns & practices
// Guidance Explorer Offline Client
//===============================================================================
// Copyright  Microsoft Corporation.  All rights reserved.
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE.
//===============================================================================



using System.Collections.Generic;

namespace GuidanceExplorer.Model
{
    public class ViewCollection : Dictionary<string,View>
    {
        /// <summary>
        /// Factory.
        /// </summary>
        /// <returns></returns>
        public static ViewCollection New()
        {
            return new ViewCollection();
        }

        /// <summary>
        /// Default constructor.
        /// </summary>
        private ViewCollection()
        {
        }

        public override bool Equals(object obj)
        {
            ViewCollection other = obj as ViewCollection;
            if (other != null)
            {
                if (this.Count != other.Count) return false;
                IEnumerator<View> _thisCollection = this.Values.GetEnumerator();
                IEnumerator<View> _otherCollection = other.Values.GetEnumerator();
                while (_thisCollection.MoveNext() && _otherCollection.MoveNext())
                {
                    if (!_thisCollection.Current.Equals(_otherCollection.Current))
                    {
                        return false;
                    }
                }
                return true;

            }
            else
            {
                return base.Equals(obj);
            }
        }

        public override int GetHashCode()
        {
            return base.GetHashCode();
        }
    }
}

